package com.itplh;

import com.itplh.common.util.PrintUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

import java.net.InetAddress;
import java.net.UnknownHostException;

@SpringBootApplication
@EnableCaching // 开启缓存
public class Application {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext app = SpringApplication.run(Application.class, args);

        ConfigurableEnvironment env = app.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        String h2url = env.getProperty("spring.h2.console.path");
        StringBuilder text = new StringBuilder("")
                .append(ip).append(":").append(port).append(h2url);
        PrintUtil.loginfo(text.toString());
    }

}
